import axios from "axios";

export default {
  props: ["dialogVisible", "opId"],
  methods: {
    async handleOpen() {
      if (this.opId) {
        this.title = "更新";
        const {
          data: { errno, message, data }
        } = await axios.get(this.getDetailUrl + "/" + this.opId);
        if (!errno) {
          for (const key in this.detailData) {
            if (data[key]) this.detailData[key] = data[key];
          }
        } else {
          this.$message({ type: "error", message });
        }
      }
    },
    handleClose() {
      this.$emit("cancel");
    }
  }
};
